package com.medistat.dialog.services;

import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.medistat.dialog.Schedule;
import com.medistat.model.Department;
import com.medistat.model.Doctor;
import com.medistat.model.FreeDay;
import com.medistat.model.Holiday;
import com.medistat.model.Setting;
import com.medistat.model.StandardPersistentObject;
import com.medistat.model.User;
import com.medistat.model.enums.Days;
import com.medistat.model.enums.TypeOfFreeDay;
import com.medistat.model.enums.TypeOfWork;

public interface DialogService {

	List<Schedule> generateSchedule(Calendar date) throws Exception;
	List<Schedule> loadSchedule(Calendar date) throws Exception;
	void saveSchedules(List<com.medistat.dialog.Schedule> schedules, Department department) throws Exception;
	
	void addDoctor(String name, String surname) throws Exception;
	void updateDoctor(Doctor doctor) throws Exception;
	public Doctor getDoctor(Long doctorId);
	void removeDoctor(Doctor doctor);
	
	List<Holiday> getAllHolidays();
	List<Holiday> getHolidaysForYear(Integer year);
	void addHoliday(Date date, String description) throws Exception;
	void removeHoliday(Holiday holiday);
	
	//it's not possible to add users. it always just one in db.
	void addUser(String username, String password, String confirmedPassword) throws Exception;
	void updateUser(String username, String oldPassword, String password, String confirmedPassword) throws Exception;
	User getUser(String username, String password) throws Exception;
	
	void addSetting(Days selectedDay, Long selectedDoctor, TypeOfWork selectedWork, Boolean ...params) throws Exception;
	void deleteSetting(Setting setting) throws Exception;
	
	void addFreeDays(TypeOfFreeDay selectedTypeOfFreeDay, Long selectedDoctor, Calendar calendarDateFrom, Calendar calendarDateTo) throws Exception;
	List<FreeDay> getFreeDays(Calendar dateFrom, Calendar dateUntil) throws Exception;
	
	<T extends StandardPersistentObject> List<T> getAll(Class<T> clazz);
	<T extends StandardPersistentObject> void saveAll(List<T> schedules) throws Exception;
	<T extends StandardPersistentObject> void deleteObject(T object) throws Exception;
	
	//statistics
	Map<String, Integer> getAllDutiesForAllDoctorsInYear(Integer year) throws Exception;
	Map<String, Integer> getAllDutiesForAllDoctorsInMonth(Integer year, Integer month) throws Exception;
}
